#ifndef SPI_DRIVER_H
#define SPI_DRIVER_H

#ifdef __cplusplus
extern "C" {
#endif

#include "driver/spi_master.h"

#define SPI_DEFAULT_FREQUENCY 1000000 // 1MHz

void spi_set_clock_speed(int speed);
void spi_init_bus(int mosi, int miso, int sclk, spi_host_device_t spi_host);
void spi_add_device(spi_device_handle_t *handle, int cs);
bool spi_write_byte(spi_device_handle_t handle, const uint8_t *data, size_t length);
bool spi_read_byte(spi_device_handle_t handle, uint8_t *data, size_t length);

#ifdef __cplusplus
}
#endif

#endif // SPI_DRIVER_H
